package com.atguigu.mybatis.mapper;

import com.atguigu.mybatis.bean.Employee;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by Smexy on 2022/11/29
 *
 *      为了开发效率，直接把sql写在接口中
 *          使用什么样的操作，就用什么样的注解

 */
public interface EmployeeMapperPlus
{
    @Select("  select * from employee where id = #{hfalieahfalh;i}")
    Employee getEmployeeById(Integer id);

    @Insert("INSERT INTO employee(last_name,gender,email) VALUES(#{lastName},#{gender},#{email})")
    void insertEmployee(Employee e);

    @Update("update employee set last_name=#{lastName}, gender=#{gender} ,email = #{email}\n" +
        "        where id = #{id}")
    void updateEmployee(Employee e);

    @Delete("delete  from employee where id = #{hfalieahfalh;i}")
    void deleteEmployeeById(Integer id);

    @Select("select * from employee")
    List<Employee> getAll();
}
